﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main()
    {
        // 1 year = 52 weekends normal

        string kindYear = Console.ReadLine();
        int p = int.Parse(Console.ReadLine());      // p holidays
        int h = int.Parse(Console.ReadLine());      // h hometown weekends

        int normalWeekends = 52 - h;
        double result = 2 * normalWeekends / 3 + p / 2 + h;

        if (kindYear == "t")
        {
            result += 3;
        }
        Console.WriteLine("{0:F0}", result);
    }
}